<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%sms}}".
 *
 * @property integer $id
 * @property string $body
 * @property string $date
 * @property string $address
 * @property string $contact_name
 * @property integer $type
 * @property string $readable_date
 */
class Sms extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%sms}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['body'], 'string'],
            [['date', 'type'], 'integer'],
            [['readable_date'], 'safe'],
            [['address', 'contact_name'], 'string', 'max' => 20],
            [['date', 'address'], 'unique', 'targetAttribute' => ['date', 'address'], 'message' => 'The combination of Date and Address has already been taken.']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'body' => Yii::t('app', 'Body'),
            'date' => Yii::t('app', 'Date'),
            'address' => Yii::t('app', 'Address'),
            'contact_name' => Yii::t('app', 'Contact Name'),
            'type' => Yii::t('app', 'Type'),
            'readable_date' => Yii::t('app', 'Readable Date'),
        ];
    }
}
